package com.jxw.launcher.view;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Point;
import android.os.Bundle;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import com.jxw.launcher.R;

/* loaded from: classes.dex */
public class DialogPrompt extends Dialog {
    private OnConfirmClickListener onConfirmClickListener;
    private TextView tv_confirm;
    private TextView tv_text;

    /* loaded from: classes.dex */
    public interface OnConfirmClickListener {
        void onClick();
    }

    public void setOnConfirmClickListener(OnConfirmClickListener onConfirmClickListener) {
        this.onConfirmClickListener = onConfirmClickListener;
    }

    public DialogPrompt(Context context) {
        super(context, R.style.Theme_Transparent);
    }

    @Override // android.app.Dialog
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.dialog_prompt);
        Display defaultDisplay = getWindow().getWindowManager().getDefaultDisplay();
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        Point point = new Point();
        defaultDisplay.getSize(point);
        double d = point.x;
        Double.isNaN(d);
        attributes.width = (int) (d * 0.5d);
        getWindow().setAttributes(attributes);
        setCanceledOnTouchOutside(false);
        setCancelable(false);
        initView();
    }

    public void setTv_text(String str) {
        this.tv_text.setText(str);
    }

    private void initView() {
        this.tv_text = (TextView) findViewById(R.id.tv_text);
        this.tv_confirm = (TextView) findViewById(R.id.tv_confirm);
        this.tv_confirm.setOnClickListener(new View.OnClickListener() { // from class: com.jxw.launcher.view.DialogPrompt.1
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                if (DialogPrompt.this.onConfirmClickListener != null) {
                    DialogPrompt.this.onConfirmClickListener.onClick();
                }
                DialogPrompt.this.dismiss();
            }
        });
    }
}
